<template>
    <div>
        <ul class="listBox">
            <li v-for="(data,index) in dataList" :key="index">
                <p @click="handleClick(data.name)">{{data.name}}</p>
            </li>
        </ul>
    </div>
</template>

<script>
export default {
  data () {
    return {
      dataList: []
    }
  },
  mounted () {
    this.$bus.$on('search', (data) => {
      this.dataList = data
    })
  },
  methods: {
    handleClick (e) {
      // this.$store.state.seatchVal = e
      this.$store.commit('listTowChange', e)
      // console.log(this.$store.state.seatchVal)
      this.$router.push('/list3')
    }
  }
}
</script>

<style scoped>
.listBox{
    width: 100%;
    height: 100%;
    background-color: #f5f5f5;
}

.listBox li{
    width: 100%;
    line-height: 2.5rem;
    background-color: rgb(255, 255, 255);
}
.listBox li p{
    color: black;
    margin-left: 1.25rem;
}
</style>
